import {
    COURSE_RECORD_INIT,
    COURSE_RECORD_CHANGE
} from '../actions';
import { updateState } from '../utils';

const INITIAL_STATE = {
    data: {},
    error: {}
};

export default function (state = INITIAL_STATE, action = {}) {
    switch (action.type) {
        case COURSE_RECORD_INIT:
            {
                return { ...state, ...INITIAL_STATE }
            }
        case COURSE_RECORD_CHANGE:
            {
                return updateState(state, action.data);
            }
        default:
            return state;
    }
}